<template>
  <a-card :bordered="false">
    <!-- 查询区域 -->
    <div class="table-page-search-wrapper">
      <a-form layout="inline" @keyup.enter.native="searchQuery">
        <a-row :gutter="24"> </a-row>
      </a-form>
    </div>
    <!-- 查询区域-END -->

    <!-- 操作按钮区域 -->
    <div class="table-operator">
      <a-button @click="selectBank" type="primary" icon="plus">申请保函</a-button>
    </div>

    <!-- table区域-begin -->
    <div>
      <div class="ant-alert ant-alert-info" style="margin-bottom: 16px">
        <i class="anticon anticon-info-circle ant-alert-icon"></i> 已选择
        <a style="font-weight: 600">{{ selectedRowKeys.length }}</a
        >项
        <a style="margin-left: 24px" @click="onClearSelected">清空</a>
      </div>

      <a-table
        ref="table"
        size="middle"
        :scroll="{ x: true }"
        bordered
        rowKey="guid"
        :columns="columns"
        :dataSource="dataSource"
        :pagination="ipagination"
        :loading="loading"
        :rowSelection="{ selectedRowKeys: selectedRowKeys, onChange: onSelectChange }"
        class="j-table-force-nowrap"
        @change="handleTableChange"
      >
        <span slot="action" slot-scope="text, record">
          <a-button type="primary" @click="toDetailPage(record)">项目详情</a-button>
        </span>
      </a-table>
    </div>
    <selectBank ref="modal"></selectBank>
  </a-card>
</template>

<script>
import '@/assets/less/TableExpand.less'
import { mixinDevice } from '@/utils/mixin'
import { JeecgListMixin } from '@/mixins/JeecgListMixin'
import FinanTenderInfoModal from './modules/FinanTenderInfoModal'
import selectBank from './modules/selectBank'

export default {
  name: 'FinanTenderInfoList',
  mixins: [JeecgListMixin, mixinDevice],
  components: {
    FinanTenderInfoModal,
    selectBank,
  },
  data() {
    return {
      description: '标段信息表管理页面',
      finanTenderInfo: {},
      selectBankOk: false,
      // 表头
      columns: [
        {
          title: '#',
          dataIndex: '',
          key: 'rowIndex',
          fixed: 'left',
          width: 60,
          align: 'center',
          customRender: function (t, r, index) {
            return parseInt(index) + 1
          },
        },
        // {
        //   title:'主键',
        //   align:"center",
        //   dataIndex: 'guid'
        // },
        {
          title: '标段编号',
          align: 'center',
          dataIndex: 'bidSectionCode',
        },
        {
          title: '标段名称',
          align: 'center',
          dataIndex: 'bidSectionName',
        },
        {
          title: '招标项目编号',
          align: 'center',
          dataIndex: 'tenderProjectCode',
        },
        {
          title: '项目名称',
          align: 'center',
          dataIndex: 'projectName',
        },
        {
          title: '公共资源交易类型',
          align: 'center',
          dataIndex: 'publicResourceType',
        },
        {
          title: '主体建设单位',
          align: 'center',
          dataIndex: 'mainConstructionUnit',
        },
        {
          title: '组织机构代码/统一社会信用代码',
          align: 'center',
          dataIndex: 'organNo',
        },
        // {
        //   title:'招标项目主键',
        //   align:"center",
        //   dataIndex: 'tenderProjectGuid'
        // },
        {
          title: '标段分类',
          align: 'center',
          dataIndex: 'sectionType',
        },
        {
          title: '标段合同估算价（万元）',
          align: 'center',
          dataIndex: 'contractPrice',
        },
        {
          title: '投标保证金金额（万元）',
          align: 'center',
          dataIndex: 'bidBond',
        },
        {
          title: '投标保证金缴纳方式',
          align: 'center',
          dataIndex: 'bondPayType',
        },
        // {
        //   title:'投标保证金账号',
        //   align:"center",
        //   dataIndex: 'bondAccount'
        // },
        // {
        //   title:'开户行',
        //   align:"center",
        //   dataIndex: 'bank'
        // },
        // {
        //   title:'户名',
        //   align:"center",
        //   dataIndex: 'accountName'
        // },
        // {
        //   title:'是否退还利息',
        //   align:"center",
        //   dataIndex: 'isBakBond'
        // },
        {
          title: '投标保证金截止时间',
          align: 'center',
          dataIndex: 'bidBondEndtime',
        },
        {
          title: '入库时间',
          align: 'center',
          dataIndex: 'version',
        },
        // {
        //   title:'招标内容',
        //   align:"center",
        //   dataIndex: 'tendererContent'
        // },
        // {
        //   title:'评标方式',
        //   align:"center",
        //   dataIndex: 'bidEvaluationMethod'
        // },
        // {
        //   title:'项目资质要求',
        //   align:"center",
        //   dataIndex: 'projectQualification'
        // },
        // {
        //   title:'项目经理（总监）专业',
        //   align:"center",
        //   dataIndex: 'projectManagerMajor'
        // },
        // {
        //   title:'项目经理（总监）最低资格等级',
        //   align:"center",
        //   dataIndex: 'projectManagerMinQualification'
        // },
        // {
        //   title:'工程专业类型',
        //   align:"center",
        //   dataIndex: 'engineeringMajorType'
        // },
        {
          title: '标段状态', //（1.正常、2.流标、3.暂停、4.终止）
          align: 'center',
          dataIndex: 'sectionStatus',
        },
        {
          title: '行政区划代码',
          align: 'center',
          dataIndex: 'areaCode',
        },
        {
          title: '交易平台编号',
          align: 'center',
          dataIndex: 'jyptBh',
        },
        // {
        //   title:'逻辑删除字段',
        //   align:"center",
        //   dataIndex: 'isdeleted'
        // },
        {
          title: '操作',
          dataIndex: 'action',
          align: 'center',
          fixed: 'right',
          width: 147,
          scopedSlots: { customRender: 'action' },
        },
      ],
      url: {
        list: '/finanTenderInfo/list',
        delete: '/finanTenderInfo/delete',
        deleteBatch: '/finanTenderInfo/deleteBatch',
        exportXlsUrl: '/finanTenderInfo/exportXls',
        importExcelUrl: '/finanTenderInfo/importExcel',
      },
      dictOptions: {},
      superFieldList: [],
    }
  },
  created() {
    this.getSuperFieldList()
  },
  computed: {
    importExcelUrl: function () {
      return `${window._CONFIG['domianURL']}/${this.url.importExcelUrl}`
    },
  },
  methods: {
    toDetailPage(record) {
      this.$router.push({
        path: '/finan/FinanProjectInfoDetail',
        query: {
          id: record.tenderProjectGuid,
        },
      })
    },
    selectBank() {
      if (this.selectionRows.length != 1) {
        this.$message.warning('请选择一条记录！')
        return
      }
      this.finanTenderInfo = this.selectionRows[0]
      this.$refs.modal.edit(this.finanTenderInfo)
    },
    initDictConfig() {},
    getSuperFieldList() {
      let fieldList = []
      fieldList.push({ type: 'string', value: 'guid', text: '主键' })
      fieldList.push({ type: 'string', value: 'bidSectionCode', text: '标段编号' })
      fieldList.push({ type: 'string', value: 'bidSectionName', text: '标段名称' })
      fieldList.push({ type: 'string', value: 'tenderProjectCode', text: '招标项目编号' })
      fieldList.push({ type: 'string', value: 'tenderProjectGuid', text: '招标项目主键' })
      fieldList.push({ type: 'string', value: 'sectionType', text: '标段分类（中文名称）' })
      fieldList.push({ type: 'number', value: 'contractPrice', text: '标段合同估算价（万元）' })
      fieldList.push({ type: 'number', value: 'bidBond', text: '投标保证金金额（万元）' })
      fieldList.push({ type: 'string', value: 'bondPayType', text: '投标保证金缴纳方式' })
      fieldList.push({ type: 'string', value: 'bondAccount', text: '投标保证金账号' })
      fieldList.push({ type: 'string', value: 'bank', text: '开户行' })
      fieldList.push({ type: 'string', value: 'accountName', text: '户名' })
      fieldList.push({ type: 'string', value: 'isBakBond', text: '是否退还利息' })
      fieldList.push({ type: 'string', value: 'bidBondEndtime', text: '投标保证金截止时间' })
      fieldList.push({ type: 'int', value: 'version', text: '入库时间（时间戳）' })
      fieldList.push({ type: 'string', value: 'tendererContent', text: '招标内容' })
      fieldList.push({ type: 'string', value: 'bidEvaluationMethod', text: '评标方式' })
      fieldList.push({ type: 'string', value: 'projectQualification', text: '项目资质要求' })
      fieldList.push({ type: 'string', value: 'projectManagerMajor', text: '项目经理（总监）专业' })
      fieldList.push({ type: 'string', value: 'projectManagerMinQualification', text: '项目经理（总监）最低资格等级' })
      fieldList.push({ type: 'string', value: 'engineeringMajorType', text: '工程专业类型' })
      fieldList.push({ type: 'string', value: 'sectionStatus', text: '标段状态（1.正常、2.流标、3.暂停、4.终止）' })
      fieldList.push({ type: 'string', value: 'areaCode', text: '行政区划代码' })
      fieldList.push({ type: 'string', value: 'jyptBh', text: '交易平台编号（暂时传行政区划代码）' })
      fieldList.push({ type: 'string', value: 'isdeleted', text: '逻辑删除字段' })
      fieldList.push({ type: 'string', value: 'projectName', text: '项目名称' })
      fieldList.push({ type: 'string', value: 'publicResourceType', text: '公共资源交易类型' })
      fieldList.push({ type: 'string', value: 'mainConstructionUnit', text: '主体建设单位' })
      fieldList.push({ type: 'string', value: 'organNo', text: '组织机构代码/统一社会信用代码' })
      this.superFieldList = fieldList
    },
    handleOk() {
      // 新增/修改 成功时，重载列表
      // this.$refs.table.refresh()
    },
  },
}
</script>
<style scoped>
@import '~@assets/less/common.less';
</style>